package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealDishMapper {

    //根据菜品id查询套餐id
    List<Long> getSetMealDishIds(List<Long> dishIds);

    //删除套餐菜品关系表中的数据
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    @Select("select * from setmeal_dish where dish_id = #{dishId}")
    void select(Long dishId);

    //根据套餐id查询对应的套餐菜品数据
    @Select("select * from setmeal_dish where setmeal_id = #{setmeal_id}")
    List<SetmealDish> getByDishId(Long setmeal_id);

    //删除套餐菜品id
    @Delete("delete from setmeal_dish where dish_id = #{dishId}")
    void deleteByDishId(Long dishId);

    //插入多条套餐数据
    void insertBatch(List<SetmealDish> setmealDishes);
}
